//
//  RYQuerenDizhiCell.swift
//  SheYangBigData
//
//  Created by 宋海胜 on 2021/1/13.
//  Copyright © 2021 叁拾叁. All rights reserved.
//



import UIKit

class RYQuerenDizhiCell: SYBaseCell {
    
    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    
    let nameLb: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1D1D1D)
        v.font = 16.autoBoldFontSize()
        v.text = "收货地址"
        return v
    }()

    let quan: UIImageView = {
        let v: UIImageView = UIImageView()
        v.image = UIImage(named: "location")
        return v
    }()
    
    let arrow: UIImageView = {
        let v: UIImageView = UIImageView()
        v.image = UIImage(named: "arrow")
        return v
    }()
    
    let title: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 15.autoFontSize()
        v.text = "请选择收货地址"
        
        return v
    }()
    
    let content: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xA6A6A6)
        v.font = 14.autoFontSize()
        v.text = "请选择"
        
        return v
    }()
    let detail: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xA6A6A6)
        v.font = 14.autoFontSize()
        v.numberOfLines = 0
        return v
    }()
    
    func configure(_ model: RYAddressListModel) {
        self.title.text = String(format: "%@ %@", model.name ?? "", model.mobile ?? "")
        content.isHidden = true
        detail.text = String(format: "%@%@%@%@%@", model.provinceName ?? "", model.cityName ?? "", model.districtName ?? "", model.streetName ?? "", model.address ?? "")
        detail.snp.remakeConstraints { (make) in
            make.left.equalToSuperview().offset(40)
            make.right.equalToSuperview().offset(-25)
            make.top.equalTo(title.snp.bottom).offset(5)
            make.bottom.equalToSuperview().offset(-13.autoWidth())
        }
    }
    
    override func initViews() {
        
        self.backgroundColor = Constant.bgViewColor
        
        addSubview(bgView)
        bgView.addSubview(nameLb)
        bgView.addSubview(quan)
        bgView.addSubview(arrow)
        bgView.addSubview(title)
        bgView.addSubview(content)
        bgView.addSubview(detail)
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(15.autoWidth())
            make.bottom.equalToSuperview()
            make.left.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-15.autoWidth())
        }
        nameLb.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(15.autoWidth())
            make.left.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-15.autoWidth())
            make.height.equalTo(16.autoWidth())
        }
        quan.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(15)
            make.width.equalTo(11.autoWidth())
            make.height.equalTo(13.autoWidth())
            make.top.equalToSuperview().offset(44.autoWidth())
        }
        arrow.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-15)
            make.centerY.equalTo(quan)
            make.width.equalTo(7.autoWidth())
            make.height.equalTo(12.autoWidth())
        }
        title.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(40)
            make.centerY.equalTo(quan)
            make.height.equalTo(18.autoWidth())
        }
        content.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-25)
            make.centerY.equalTo(quan)
            make.height.equalTo(15.autoWidth())
        }
        detail.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(40)
            make.right.equalToSuperview().offset(-25)
            make.top.equalTo(title.snp.bottom).offset(5)
            make.bottom.equalToSuperview().offset(-13.autoWidth())
        }
    }

}
